
<template>

</template>
<script setup lang="ts">
import { watchEffect } from 'vue'
// watchEffect: 将创建与销毁逻辑放在同一函数中

let num = 0


watchEffect(closeEffect => {
    let timer = setInterval(() => {
        document.title = num++ + ''
    }, 1000)

    // console.log(closeEffect)

    closeEffect(() => {
        clearInterval(timer)
    })

})
</script>